package com.leetcode.题库;

/**
 * @author 覃国强
 * @date 2022-02-20 16:18
 */
public class 题库_0717_1比特与2比特字符 {

  static
  class Solution {
    public boolean isOneBitCharacter(int[] bits) {
      if (bits.length == 1) {
        return bits[0] == 0;
      }
      for (int i = 0; i < bits.length; ) {
        if (i == bits.length - 1) {
          return bits[i] == 0;
        }
        if (bits[i] == 1) {
          i += 2;
        } else {
          i += 1;
        }
      }
      return false;
    }
  }

}
